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. As new monomers are linked to the existing rows of peptidoglycan during cell wall synthesis, 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.
Penicillins, cephalosporins, and other beta-lactam antibiotics resemble the two terminal amino acids of the monomer's pentapeptide (D-Ala-D-Ala) to which transpeptidases normally bind. By binding to and tying up the active site of the transpeptidases, these antibiotics block the formation of the peptide cross-links. This results in a weak cell wall and osmotic lysis of the bacterium.