This is an example of a "signpost" -- something that gives
the user a clue where he is. It does so with some subtlety; colors
work visually instead of verbally, and it's not even something
that users will necessarily notice immediately (though it's hard
to miss in the vivid Coltrane example above). Once users are
attuned to the color schemes, they can use them. Even before
then, they'll know when they've left one section for another, if
they notice that the color scheme changed.
So color-coding works to distinguish one section from another; it
makes the boundaries clear. It's easier for users to mentally map
out smaller chunks of a navigational space, such as one section,
than the whole space at once -- you should do this with a large UI
in any case, whether you use color coding or not.
Creative uses of different colors can also make your UI look
nicer and less boring. It might even contribute to the branding
of the UI -- see the Apple example below.