Gram staining is essentially a differential staining technique. It is primarily used to detect the presence of bacteria at the site of a suspected infection and to differentiate between gram positive bacteria and gram negative bacteria. Gram staining may also be used to determine the composition of the cell wall.