I'm doing a research project and I would like to know the reason why the Middle Ages and Government are written with capital letters. Is it really obligatory to do so or just common??? Anyone who could help me, will be welcome with any comment they have.

Thank you.
'The Middle Ages' is capitalized because it is the name of a specific period in European history; you will (almost) always find it capitalized, even when it is used to refer to other geographical areas as in 'Japan's Middle Ages'.

'Government' you should not find capitalized unless it is used to refer to it as a sort of personified entity, as in 'Government has joined with Big Business to squeeze out the small entrepreneurs'.
The Times Guide to English Style and Usage:
government always lc, including British government, except in official titles such as Government House and Her Majesty's Government.... If in doubt use lower case.