The Gram stain procedure enables bacteria to retain colour of the stains based on the differences in the chemical and physical properties of the cell wall.
Gram positive bacteria stain dark purple due to retaining the primary dye called Crystal Violet in the cell wall. Gram-positive bacteria have a thick mesh-like cell wall which is made up of peptidoglycan (50-90% of cell wall).
Gram negative bacteria stain red or pink due to retaining the counter staining dye called Safranin. Gram-negative bacteria have a thinner layer of peptidoglycan (10% of the cell wall). They lose the crystal violet-iodine complex during decolourization with the alcohol rinse, but retain the counter stain Safranin. Hence, appear reddish or pink.
Regards