Yes, usually the correct usage pattern for a cluster is to compile on the login node, and run the code on the worker nodes. Since this is the correct usage pattern, most systems are designed such that the login node and the worker nodes are identical (or nearly identical).
Grids are different. A grid is a collection of resources under different administrative domains. Most grids standardize on a single operating system and architecture, out of convenience, but the underlying machines may be completely different. Also, there is no head node of a grid, as there may be many submission nodes.
Typically, an application is compiled for the lowest common denominator OS for a grid, which hopefully will work everywhere. For example, on the OSG, the lowest common denomiator is a redhat 5 compatible OS (which include CentOS 5, SL5...). But, the OSG is slowly transitioning to redhat 6 compatible. Therefore, there are different OS's on clusters, but some applications may work on both. Some applications will need to be restricted to only 1 of the OS's. This is an ongoing problem for grids, since they may not be virtualized like Clouds.