Gram staining is a differential staining technique that categorizes bacteria into two groups: Gram positive and Gram negative. The process involves staining bacterial cells with crystal violet, followed by a counterstain such as safranin. Gram negative bacteria do not retain the crystal violet stain due to their thinner peptidoglycan layer and instead appear pink or red after counterstaining.