Gram staining, invented by Christian Gram, is a technique used to differentiate two large groups of bacteria based on their different cell wall constituents.
Gram positive bacteria get stained by crystal violet and appear purple in colour. On treatment with alcohol, they retain the purple colour. This is due to the presence of a thick layer of peptidoglycan in their cell walls.
Gram negative bacteria also get stained by crystal violet and appear purple. But on washing with alcohol, they get destained and appear colourless. This is because of a very thin peptidoglycan layer that is sandwiched between an inner cell membrane and a bacterial outer membrane which contains lipopolysaccharides. The lipopolysaccharides, because of their high lipid content, dissolve in the alcohol and get washed off, causing the stain to disappear.