The chemical formula for emerald is Be3Al2(SiO3)6. Note that the formula for emerald is actually that of beryl. This is because emeralds are a variety of beryl.
The green color in emeralds is due to trace impurities (usually due to chromium, but also sometimes vanadium.)
Pure beryl is colorless, but due to impurities, it can be green (emerald), blue, yellow, white, or red. Aquamarine, emerald, heliodor, and morganite are all varieties of beryl.