A cave castle is a refuge or residential castle that was built to a large extent using natural rock caves.
Cave Castle are castles built into caves. Unlike cave houses, which are mostly artificial dugouts, cave castles are typically built into natural caves. However, the castle is artificial and the caves are often artificially widened, so they are listed here with subterranea.
Caves have ever been a place for man, to hide from weather or enemies. So it seems not unusual, that several castles were built into special caves all over the world, using their extraordinary structure for the security or comfort of the inhabitants.
The term grotto castle is also sometimes used, but it is now outdated and only makes sense as a proper name. It is based on the idea that grottoes are a special form of caves that have a very shallow depth, usually just overhanging rock walls without actually having a cave behind them. In the course of time, this term has undergone a transformation and now rather means an artificial and elaborately decorated or otherwise richly furnished small cavern. Moreover, the vast majority of cave castles would then actually be grotto castles, because the cave wall forms the back of the castle and a deep cave is therefore rather impractical. However, the term is used in the German Schwitzerdütsch, where it means the same as cave castle.
The word castle often implies something like medieval castles in Europe, so the first idea is that cave castles are found only in Europe. But there are cave castles everywhere on earth where people lived. It seems most cultures on earth needed protection, against enemies or against wild animals. A castle is a small village with a wall around to keep others outside. Even remote monasteries are sometime indistinguishable from cave castles, think about the castle-like monasteries at Meteora. A great number of cave castles exist in southern France, built and used by Huguenots, protestants which were at some point pursued in catholic France of the 16th century.
So why build castles into caves? That's simple: because it means less work. If you use a cave, typically an entrance portal in a cliff face, you have numerous advantages: The rear side is protected by the mountain itself, and there is shelter by the cave roof, so it is not necessary to build a massive back side or a stable roof. And the front is often high above the neighbourhood, so fortifications on that side are also easier to build. But there are still more advantages of caves. Many caves have a cave river or some kind of flowing water, which could be used for collecting drinking water. Because this spring is inside the cave, it can not be poisoned by enemies. And some of those caves have other entrances, which - if known only to the people inside the castle - can be used to refill the stock, get more defenders or flee, if necessary. Predjamski Grad or Höhlenburg Lueg near Postojna in Slovenia has such a back entrance, which was used by the knight Erazmov, who got fresh vegetables and fruits from villages nearby and threw them down to the besiegers to demonstrate his good stock and thus demoralise the enemies. This is probably the most famous cave castle of the world.