How the Grimaldis came to live on the Rock

It’s an iconic symbol of the Principality of Monaco, but how did the Grimaldi family come to call this famous Rock their home?