Setsumatsusha
Sessha (摂社, auxiliary shrine) and massha (末社, undershrine), also called eda-miya (枝宮, branch shrines) (collectively known as setsumatsusha (摂末社)) are small or miniature shrines entrusted to the care of a larger shrine, generally due to some deep connection with the enshrined kami.
The two terms used to have legally different meanings, but are today synonyms. Setsumatsusha can lie either inside (境内摂末社, keidai setsumatsusha) or outside (境外摂末社, keigai setsumassha) the main shrine's premises. Setsumatsusha are usually 1x1 ken in size. They can however be as small as beehives or relatively large and have 1x2, 1x3 or even, in one case, 1x7 bays.
History
The practice of building sessha and massha shrines within a jinja predates written history. The earliest setsumatsusha usually had some strong connection to the history of the area or the family of the enshrined kami.
During the Heian period, Ise Shrine used to make a distinction between the two types based on whether a shrine belonged to the Engishiki Jinmyōchō list (sessha) or to the Enryaku gishikichō list (massha).