Beer colour comes from the different types of malted grains used, each of which has its own characteristic colour. Colour is often the first check made in a judging competition to see how well a beer has been brewed to style.
The main colour constituents are melanoidins (high molecular polymers!) produced by browning reactions between sugar and amino acids in the grain when it is heated to produce the malt. Browning occurs whenever food is heated - think toast.
Different heating and germination procedures (see blog 2) therefore produce different sugars and amino acids which in turn produce a wide spectrum of malted grain colours, from amber to red to black.
Other variables such as boil duration, heating method and quantity of hops added also affect the final colour of the beer during the brewing process.