To compile kernel from source, check out this blog post from cyberciti -
http://www.cyberciti.biz/tips/compil...kernel-26.html
Though this is for compiling kernel ver 2.6, it should work fine for the latest 3.x.x too.
And coming to your next question, the purposes vary. Kernel is something like a heart of your linux system. By compiling kernel on your own rather than depending upon the distro updates, you can start using latest kernels once they are released, try out unstable versions, add features to your kernel which were not there in the kernel given to you by your distro maintainer and so on.
Regards,
fierytux