Bacteriophages express endolysins which are the enzymes that hydrolyze peptidoglycan resulting in cell lysis and release of bacteriophages. Endolysins have acquired stringent substrate specificities, which have been attributed to cell wall binding domains (CBD). Although it has been realized that CBDs of bacteriophages that infect Gram-positive bacteria target cell wall carbohydrate structures, molecular mechanisms that confer selectivity are not understood. A range of oligosaccharides, derived from the secondary cell wall polysaccharides of Bacillus anthracis, has been chemically synthesized. The compounds contain an α-d-GlcNAc-(1→4)-β-d-ManNAc-(1→4)-β-d-GlcNAc backbone that is modified by various patterns of α-d-Gal and β-d-Gal branching points. The library of compounds could readily be prepared by employing a core trisaccharide modified by the orthogonal protecting groups N(α)-9-fluorenylmethyloxycarbonate (Fmoc), 2-methylnaphthyl ether (Nap), levulinoyl ester (Lev) and dimethylthexylsilyl ether (TDS) at key branching points. Dissociation constants for the binding the cell wall binding domains of the endolysins PlyL and PlyG were determined by surface plasmon resonance (SPR). It was found that the pattern of galactosylation greatly influenced binding affinities, and in particular a compound having a galactosyl moiety at C-4 of the nonreducing GlcNAc moiety bound in the low micromolar range. It is known that secondary cell wall polysaccharides of various bacilli may have both common and variable structural features and in particular differences in the pattern of galactosylation have been noted. Therefore, it is proposed that specificity of endolysins for specific bacilli is achieved by selective binding to a uniquely galactosylated core structure.