In this paper we review recent progress in studying quantum phase transitions in one- and two-component Bose–Einstein condensates (BEC) in optical lattices. These phase transitions involve the emergence and disappearance of quantum coherence over the whole optical lattice and of linear superposition of macroscopic quantum states. The latter may provide new means to engineer and manipulate novel macroscopic quantum states and novel coherent atomic beams for quantum information processing, quantum computing and other purposes.