BMW is set to build an assembly plant in Brazil to benefit from growing demand for luxury cars in South America's largest economy.