The engines are always painted a certain colour but the front part is always grey.
Why is it that?
The engine inlet lip is bare metal to facilitate anti-icing. The area is heated from within using hot engine bleed air.
This partial schematic (from Boeing AERO QTR_01.12) shows the engine anti-ice valve, which controls the air supply to the inlet lip:
Interesting side note: Even the 787 "no-bleed" system architecture uses bleed air for engine anti-ice.
There are two reasons I can think of for this:
Aerodynamic reasons. Believe it or not, even paint can change the dynamics of a plane, to the point that Boeing discourages multi-colored paint jobs or liveries on 787 nacelle, claiming they affect performance.
If that part of the engine were painted, there would be risk of paint chips being sucked into the engines, potentially damaging them. While this may seem far-fetched, this account shows that even paint chips can pose a foreign object debris threat to an engine. By not painting this part of the nacelle, the risk of paint flecking off and into the engine is reduced.