I might be wrong, but I think the first 16 colours are all the primarys, secondarys and their half-brights.
So
black
red
green
blue
cyan
magenta
yellow
white
black
dark red
dark green
dark blue
dark cyan
dark magenta
dark yellow
grey
then the rest are just whatever is hanging around from anything that's been run before, like bios/windows boot up screens.
This palette is the one I used in my ASCII movie player :-)
Having said that, I've just read they're not necessarily standard across all VGA cards.
edit: This is much more useful
http://answers.google.com/answers/threadview?id=126097Jim