In order to understand the action of the gram stain in differentiating the bacterium, we need to have a look at the cell wall composition of the bacteria .In them, the cell wall has a little difference .
Cell Wall in Gram positive bacteria

  •  Has relatively   thick layer of  peptidoglycan ,
  • Techoic acid (polymer of  glycerol or ribotol connecterd with phosphate groups,
  • The various layers of peptidoglycan are linked by covalent linking of techoic acid to muramic acid to form a mesh

Consequence— The crystal violet color is not allowed to decolorize , so the cells appear blue black

Cell Wall in Gram negative bacteria

  • In gram negative bacteria, the cell wall is much thinner with low peptidoglycan concentration but high lipid content.
  • Hence the crystal violet gets  decolorized when washed due to restraining activity of the  mesh like peptidoglycan  in gram positive cells.
  •  Besides, in gram negative bacteria, the outer part of cell wall is high in lipid, polysaccharides and proteins, but there is a space called  periplasmic space outside the central membrane external to which is the peptidoglycan  followed by the final external membrane
  • Thus another stain (counter stain ) becomes very important .