During normal bacterial growth, bacterial enzymes called autolysins put breaks in the peptidoglycan in order to allow for insertion of new peptidoglycan monomers - consisting of NAG, NAM, and a pentapeptide. These monomers are then attached to the growing end of the bacterial cell wall with transglycosidase enzymes. Finally, transpeptidase enzymes (also called penicillin-binding proteins) form a peptide bridge that cross-links the peptides coming off of each NAM. These links connect each row of sugars with its adjacent rows and each layer of peptidoglycan with its adjacent layers. This is what gives peptidoglycan its strength.
Vancomycins bind to the two terminal amino acids of the monomer's pentapeptide (D-Ala-D-Ala). This binding prevents the transpeptidase enzymes from forming the peptide cross-links between the rows and layers of peptidoglycan. (As a result of of steric hindrance, not shown here, vancomycin may also interfere with the formation of the glycosidic bonds between the sugars of the peptidoglycan monomers and those in the existing cell wall). This results in a weak cell wall and subsequent osmotic lysis of the bacterium.