Castle Grayskull is a spooky place. It's a big, old,and decrepit castle with a freaking skull for a front door. Inside is all sorts of magic and sorcery. Hard to believe this is the good guys place, but it is... well unless Skeletor takes over and becomes Master of the Universe. While there's all sorts of scary things within, one particular ghost serves a purpose. The Spirit of Grayskull is the voice of the castle itself. He serves to guide those within on matters like the power sword and becoming King of the Castle.
Originally the spirit was depicted as a cloud like skull face and was a more involved fictionally in the early days, but did stick around. He appears in the original Filmation cartoon as a disembodied head. Later in Classics, it was established to be the ghostly form of King Grayskull himself. Personally I prefer those earlier depictions. Eternia and all it's citizens were more raw and that floating skull coming out of a skull shaped haunted castle was just perfect.