Catalyzes the synthesis of carnosine and homocarnosine. Carnosine is synthesized more efficiently than homocarnosine. ATP + beta-alanine + L-histidine = ADP + carnosine + H(+) + phosphate 4-aminobutanoate + ATP + L-histidine = ADP + H(+) + L-homocarnosine + phosphate Binds 2 magnesium or manganese ions per subunit. Homotetramer.