Many aquaria are saturated with dissolved mineral salts such as magnesium and calcium carbonates. In the sand bed where water flow is slow and the chemical milieu is different than in the water column, precipitation of calcium salts can cause clumping. The high pH environment you mention facilitates this clumping. In essence, in such a situation what is created is a type calcareous sandstone.
The other cause is clumping due to bacterial cementation. The bacteria in the sand bed glue the grains together with a material referred to as a glycoprotein; basically this is a material about the consistence of rock candy. Once the bacteria have bound the sediment, the minerals can also precipitate and make the binding permanent.
When one inoculates a sand bed, one needs to strive for maximum diversity of the burrowing infauna. The action of these small animals will keep the sediment rather continuously in motion and prevent the cementation. In addition to the lack of these "motivators" of sediment motion, the larger sediment particles tend to resist movement, and consequently facilitate the cementation.