mp4 is a container - just like avi is. though generally it contains h264 variants.
xvid is a enhanced divx codec, it is supported by many set top dvd players, handheld devices and offers a good size to quality ratio.
h264 can yield great results, however it requires more hardware to decode. It can be allot more fiddly to encode to obtain good results, I'd say it is better if done correctly.