Pyramid is an adventure map location, which is guarded by 40 Gold Golems and two stacks of 10 Diamond Golems. After defeating the guards, hero will learn typically a fifth level spell provided that the hero has expert Wisdom and a spell book. If the hero does not have a capability to learn the spell, it is lost forever. If the hero retreats or dies during the battle, the already defeated golems are replenished (unlike in creature banks). Searching an empty pyramid decreases hero's luck by 2.
A curious detail is, that in the versions 1.2 of Restoration of Erathia and 2.0 of Armageddon's Blade, a hero could receive a message that he has learned Fear spell from the pyramid. However, such spell cannot be found in the spell book. This anomaly was removed in the versions 1.3 and 2.1, respectively.