When confronted with a new bacteria there are a series of simple tests that can be carried out to give a rough idea of the properties of the bacteria you are dealing with. One of the simplest and most useful tests is known as "Gram staining" which is a process of staining cells either purple or pink depending on the properties of their cell walls. It was discovered by Christian Gram who wasn't initially trying to find a test for bacteria, he just wanted to make them visible.
Gram staining colours the bacteria either purple, in which case they are referred to as "Gram positive," or pink which are known as "Gram negative". Although Christian Gram didn't realise it at the time, this different response to the staining technique is due to a fundamental and important change in the structure of bacteria. Gram positive cells have large bulky cell walls made out of a substance called peptidoglycan. In contract Gram negative bacteria have two thin cell membranes with a thin peptidoglycan layer between them.
To carry out a Gram stain, the bacteria are first washed in a purple stain called crystal violet followed by iodine. The iodine and crystal violet form large complexes which bind to the cell and turn it purple. The cells are then washed with alcohol which strips outer lipid layers away from the cell. The Gram positive cell looses some of its large chunky peptidoglycan cell wall but keeps enough of it to retain the purple colour. The Gram negative cell has its outer membrane and small peptidoglycan layer completely stripped away, leaving it colourless. The cells are then given a second stain with a compound called safranin. This turns the colourless Gram negative cells pink but is not strong enough to affect the deep purple colour of the Gram positive cells.
This difference in cell wall structure affects far more than just the response to colourful stains. Gram negative cells are more likely to be resistant to antibiotics, but are more susceptible to detergents. Gram positive bacteria produce a large number of exotoxins - harmful substances that are secreted from the bacteria into the environment. Gram negative bacteria have a high lipid content in their outer membrane including the endotoxin LPS which activates strong immune system responses in humans. Unlike the exotoxins, this endotoxin is not released from the bacteria on purpose but can be recognised by the immune system.
There are also some bacteria that are neither Gram positive nor Gram negative, but are known as "Gram-indeterminate". These include strange and wonderful things like mycobacteria (which have a cell wall that resists stain removal) and even bacteria with no cell wall at all!
Credit link for image 1
Credit link for image 2