This is because some chemicals are photosensitive meaning that they break down when exposed to light. A good example of this is Hydrogen Peroxide (H3O). Because the bonds are unstable due to the fact that oxygen can only bond with two other electrons when each of the Hydrogens each have one electron. Therefore the energy of the light (photons) is great enough to break it up into water and Hydrogen gas. The dark colored glass helps to reflect or absorb most of the light so that the breakdown process happens much slower or not at all.
Some liquids or chemicals can be altered by sunlight, the dark colored bottles helps prevent this.