"Your children entered the shrine of Your House, cleansed Your Temple, purified Your Sanctuary, kindled lights in Your holy courtyards." (Siddur, Al Hanisim)
The kindling of the Menorah took place in the Beit Hamikdash itself. Why did the Hasmoneans kindle it in the courtyard?
When the Hasmoneans entered the Beit Hamikdash, they found it defiled and in ruins. Thus, they were unable to kindle the Menorah while it stood in its regular place. In the interim, while they were cleaning the mess and renovating, the Menorah was kindled in the courtyard. This is permissible according to halacha (see Rambam, Hilchot Biat Hamikdash 9:7).
The Lubavitcher Rebbe questions:
Through kindling the Menorah in the courtyard, everyone was able to witness the 8-day miracle (which would not have been the case had it been lit inside, then only the Kohanim would have seen it).
With this explanation, we can answer the popular question of why Chanukah is celebrated for 8 days instead of 7, though sufficient oil was found for the first night. The oil found would have lasted through the night, if the Menorah would have been kindled inside. However, Chanukah takes place during the winter, and due to weather conditions, the oil would normally not have been sufficient to last through the night, when the Menorah was kindled outside, in the courtyard.
Accordingly, grammatically it should be in singular: "bechatzer kadshecha" "in your holy courtyard" in lieu of the plural, "bechatzrot kadshecha" "in your holy courtyards."
Thus, he asserts that the Menorah was indeed kindled in the Beit Hamikdash. However, as an additional expression of joy and happiness, all the courtyards in the outskirts of the Beit Hamikdash were also illuminated with an abundance of light (as it was customary during Simchat Beit Hasho'eivah celebrations).