The undercoat provides an initial coat of paint to the figure that the subsequent paints can key to. If you were to paint directly on the figure before an undercoat was applied, then you would find that the colours you paint would not be as vibrant. I have seen three colours typically used as undercoat, although any colour will suffice, and there may be justification for using a specific colour (a deep red for a red dragon for example). The most common colours and favourites are white and black, and less frequently grey.
White makes the model colours really stand out, but means that you have paint the figure thoroughly, and get into every nook and cranny. Figures with flamboyant, multi-coloured clothes really suit a white undercoat.
Black is a good colour for beginners, but also for those who need to paint a lot of figures quickly (e.g. you are making an army of goblins for a weekend wargame). The reason for black being so good for the previous is because the black can be left exposed on the figure in all the recesses, and doesn’t look out of place since the recesses would typically be in shadow anyway.
Grey is sort of a middle ground, in that the colours can be more vibrant that black, but unless the grey is quite a dark grey it still has the downsides of white. Personally I would avoid grey for this reason.
Which undercoat colour you choose from Black or White is really a matter of taste and the amount of time you are willing to devote to painting your figure. In conclusion however I would say if in doubt, stick with Black, as this is the most forgiving colour giving the best result for the least amount of work.
Have any good tips, or links to pages about undercoating? Then please leave a comment below!