Transparency sets one of the indexed colors in the file to be transparent instead of a displayable color.
Only GIFs and PNGs can have a transparent area. GIF and PNG files are made of a fixed set of indexed colors. The transparency feature lets you tell one of those indexed colors to be transparent and let the background of the Web page show through. The alpha channel is somewhat analogous to a mask in print production.
For example, because the triangle has a transparent background, it can be placed on any page or table cell and the page or cell color will show through:
Each pixel in the GIF or PNG file can be one of a set of indexed colors. There can be as many as 255 indexed colors in a GIF or PNG file. The colors are described by three color channels: red, green, and blue. Each of the indexed colors is made of some percentage of these three colors.
In addition, the file formats support a fourth channel, the alpha channel. The alpha channel can record places in your image which are "background" and set that index color to have a transparent value.
If you are working with a graphic and have set the file background to "transparent" you have, in effect, set an alpha channel value. When you export that file as a transparent GIF/PNG, that "color" will be transparent.
You can also set a particular indexed color to be transparent. For example, if your graphics file has a black background, you can set black to be the indexed transparency color; everything that is black wiil be transparent.
Image editing programs such as Fireworks and Photoshop export transparent GIFs. Here's an example of the Fireworks export box: