Gram staining is a typical method for distinguishing two big groups of bacteria based on the constituents of their cell walls.
Peptidoglycan is a polymer of amino acids and sugars that makes up bacterial cell walls.
The peptidoglycan layer's structure is critical to bacterial life since it is the foundation for bacterial species' functional division.
Gram-positive cells have a thickened peptidoglycan layer that allows them to retain the primary stain applied (therefore they are called gram-positive or stain positive bacteria). These cells give a purple/violet colour upon visualization.
Gram-negative cells have a thin coating of peptidoglycan that allows the primary stain to escape. These cells take up the secondary stain that is added and ultimately give a pink/red colour upon visualization.