When to grout, when to caulk?

As I was showering last week, the line of grout between the shower pan and the bottom of the ceramic tiles, suddenly spit itself out onto the floor of the shower. This got me thinking: Should there have been grout there in the first place? Then I started looking around the bathrooms. The installers grouted between the bottom of the tiles and the tub in the second bathroom as well. They also grouted between the vanity top and the wall. So my question is: when do you grout and when do you caulk? I'm wondering what to do to solve the missing grout problem in the shower first, since I'm pretty sure that it would be a good idea to put something down there to shed off the water. - Steve