Although the most familiar example of bioluminescence is the firefly, most bioluminescence occurs in the deep ocean.
Different creatures use bioluminescence in very different ways.
Some use it to lure prey into their mouth, others use it to escape from predators, and others use it to attract a mate. Bioluminescence is produced by the oxidization of luciferin. This reaction is catalyzed by the enzyme luciferase. When the pH is low enough, the luciferin disassociates with the LBP and is catalyzed by the luciferase. Sometimes the addition of a calcium ion is used to control the reaction instead of a drop in pH. Researchers still have a long way to go in understanding the complex ecosystem of the ocean, where most bioluminescence occurs.