Recognise command and colour it on the terminal? I was wondering if it's possible to colour a recognised command in real time while typing and/or when switching to previous commands using the arrows.

For example, if I start typing gre, it should not color anything, but once I finish typing my command completely, i.e. grep, it should color grep with a certain color.

This would be useful to immediately recognise also the position of arguments in a complex command. I'm using the default terminal that comes with the notebook.
Not a bash answer, as I don't have one, but if you switch your shell to zsh (a close relative of bash) and install the configuration framework prezto you'll get this functionality more or less out of the box, as well as significantly better autocompletion. Switching to zsh most likely won't change your day to day bash workflow at all, but it'll open a a lot of doors in terms of customisation and extension, and also adds some clever features worth learning - like shared command history across all prompts that can be included in the autocompletion dictionary, file globbing to efficiently work with multiple files at once, and most importantly compatibility modes, whereby zsh can emulate another shell - meaning that if some of your bash scripts don't work the way they used to after switching to zsh, you can just emulate it - although personally all the bash scripts I've written still worked fine in zsh. 

Useful links:


Installing the latest version of zsh in OS X
Installing prezto
Some in-depth discussion of how switching can improve your workflow