From a visual perspective, fire is essentially hot gas and soot particles that emit light. Most flames consist mostly of soot which is Carbon. Carbon is what is called a Black Body. A Black Body absorbs all light that hits it, hence it is black. However, when it's temperature rises to over about 600 Kelvin, it starts to emit light in a very characteristic way. This is where the familiar red/orange/yellow/white colors come from. Because fire mostly consists of soot particles, this is what dominates the color of flames.
Since soot particles emit the light of a flame, that means that the more soot particles there are, the brighter the flame will be. On the other hand, since Black Bodies also absorb light, more soot particles also make the flame more opaque. These two effects are exactly what is controlled by the Opacity group of the Fire Shader. This is what you use to control the shape of the flame.
To control the color you have two options. One is to specify a color gradient directly and the other is to use the physical model that describes the colors of a radiating Black Body. The later will give you an easy way to obtain realistic colors, while the former gives you full artistic freedom. When using the custom gradient, take care that you use a high dynamic range of colors (also make sure that the Clamp checkbox is not checked). Look at the intensity values of the default color gradient as an example. It actually has a constant orange color. Only the intensity runs from 0% to 2000%.
As mentioned above, you can shade fire using several different simulation channels. The density-based-flame example uses the temperature field to drive the color and the density channel for the opacity. While the fuel-based-flame shows pretty much the same using the Fuel and Fire channels. The Fuel channel gives you more freedom to simulate a reaction, but regarding shading it behaves the same. In these examples, the Mapping of the Opacity group creates the typical flame shape. A rising plume of fuel will only burn at the outer contour where there is enough oxygen. That means that most light is also emitted only from these areas. The Mapping function curve exploits the property of Density and Fire fields that they have their large values inside the plume/flame and smaller values outside. By creating a peak in the Mapping you specify where the surface of the flame should be that emits most of the light. See section 19 on the F-Curve editor for more details on how you can design the mapping curves.
You can also use the Fire channel to drive the color or the opacity or both. You can even shade flames without using an opacity channel at all. Note that in this case you won't have alpha information to composite your flame later on, though. You still composite such a flame by using the brightness of the flame as a matte channel. This is justified by remembering that the brighter the flame is, the more soot particles there are and the more opaque the flame will be.