The biosynthesis of the phosphoglycolipid antibiotic moenomycin A attracts the attention of researchers hoping to develop new moenomycin-based antibiotics against multidrug resistant Gram-positive infections. There is detailed understanding of most steps of this biosynthetic pathway in Streptomyces ghanaensis (ATCC14672), except for the ultimate stage, where a single pentasaccharide intermediate is converted into a set of unusually modified final products. Here we report that only one gene, moeH5, encoding a homologue of the glutamine amidotransferase (GAT) enzyme superfamily, is responsible for the observed diversity of terminally decorated moenomycins. Genetic and biochemical evidence support the idea that MoeH5 is a novel member of the GAT superfamily, whose homologues are involved in the synthesis of various secondary metabolites as well as K and O antigens of bacterial lipopolysaccharide. Our results provide insights into the mechanism of MoeH5 and its counterparts, and give us a new tool for the diversification of phosphoglycolipid antibiotics.