The molecular basis of the Gram stain is the amount of peptidoglycan in the bacterial cell wall.
Explanation;
Gram stain is differential stain that is very useful for identifying and classifying bacteria as either gram negative or gram positive.
Gram negative are those that decolorize easily, such as E. coli, while Gram positive are those that retain the primary stain and do not decolorize easily.
The result depends on the bacteria cell wall structure, the cell wall of a Gram-negative bacterium is composed of 20 percent or less of peptidoglycan.