What is it?
The Montreux Convention is an international agreement governing the passage of ships (civilian and military) through both the Dardanelles and the Bosporus, thus between the Mediterranean Sea and the Black Sea. It was signed on July 20, 1936, by representatives from Turkey, the USSR, Yugoslavia, Greece, Germany, Bulgaria, Great Britain and France. Japan signed as well, with reservations. The United States was not a signatory to the Convention (and in fact didn't even have a presence at the negotiations or signing), but has historically abided by its rules. Turkey is recognized as the controlling nation of these waterways, and the Convention dictates how it must treat vessels of other nations with respect to passage. In addition, the Convention explicitly permits the fortification of the Straits by Turkey in order to exercise the controls laid out within, reversing a then-current demilitarization of the Straits.
What does it say?
There are several provisions laid out. Articles Two through Seven govern merchant traffic. Merchant shipping is guaranteed freedom of transit of the waterways above (collectively called 'the Straits'), no matter what their flag or cargo, although Turkey may if it chooses require ships to stop at an inspection station for sanitary and health control reasons. This freedom holds during peace and during any war in which Turkey is not a belligerent. In time of war where Turkey is a combatant, merchant ships of those nations not at war with Turkey retain these rights of passage. If any nation fails to uphold its neutrality (i.e. uses its shipping to support one or other of the belligerent nations) then ships of their flag or registration may have their passage rights revoked.
The military provisions, Articles Eight through Twenty-Two, are more interesting. Under the Convention, 'light surface vessels' of any nation (defined by the the Convention as warships displacing between 100 and 10,000 tons) may transit the straits during peacetime provided they provide advance notice to Turkey. There are several more fiddly limits, which on careful examination all tend to reflect the strategic interests of the signatory powers. For example, no 'capital ships' - those over 15,000 tons displacement - of non-Black Sea powers are permitted to transit the straits at any time. This tonnage, while somewhat light for a large warship of the time, was fairly carefully crafted to exclude the then-new German 'pocket battleships' - small battleships intended for commerce raiding.
Aircraft carriers are forbidden from transiting the straits. This represents a significant change from earlier practice as laid out by the Lausanne Treaty of 1923. It was proposed by the Soviet Union, and reflects the concern of a state which (at the time) had no aircraft carriers that those navies which possessed them should be kept as far from their shores as possible. In order to make this change, the definition of 'Capital ships' in the Convention specifically excludes aircraft carriers, which are given their own category.
There were regionally-specific exemptions as well. The Black Sea powers - states with coastlines on the Black Sea - were allowed to transit capital ships (but not aircraft carriers) provided they remained in compliance with the rest of the Convention, which included limiting the number of capital ships of any power in the Straits to one at any given time. Black Sea powers are also allowed to transit submarines through the Straits so long as said submarines have been constructed, purchased or sent for repair outside the Black sea. This is essentially for the benefit of Russia, whose submarine fleets are deployed between three coasts - two of which lie outside the Black Sea.
There are many other rules laid down which are not repeated here. For example, there are limitations on the bore size (calibre) of the guns permitted on capital ships to eight inches. However, a decision by Turkey in the 1960s to allow a U.S. warship with 305mm ASROC weapons aboard, despite an objection by the USSR that this contravened that clause, set the precedent that missile weapons do not fall afoul of the gun limits.
Why was it written and signed?
In 1936 the balance of power in Europe and Asia Minor was visibly upset. A newly-resurgent Germany had begun rearmament, and Italy (under Mussolini) was then an expansionist power. Prior agreements over the Straits, intended to cement post-World War I relations, were swiftly becoming obsolete. The eventual Allied powers (chiefly Britain) were eager to cultivate friendlier relations with Turkey in order to prevent her siding with Germany and/or Italy in the event of war, and the USSR was able to leverage this desire of the Western powers to exact many of the concessions listed above.
The instrument governing the Straits prior to the Convention was the Treaty of Lausanne, which was signed in that Swiss town in 1923. That document provided fairly simply for freedom of navigation of the Straits for all powers at all times, and had been intended to ensure the passage of Western shipping. It made little provision for the restriction of warships, and prevented Turkey from fortifying the Straits. As such, it needed to be updated in order to deal with the threats posed by European powers (among others).
Invocations and arguments
The Convention, originally intended to protect access to the Black Sea for shipping and to protect the weak ports of the USSR, began to chafe on that power after World War II. As the Soviet Union built up its navy, it wished to begin exercising presence power in the Mediterranean, and starting in 1946 it began to push for revisions of the Montreux Convention in its favor. However, Turkey joined NATO, and with that backing refused to modify the terms. The Soviet Navy was forced to abide by the existing rules.
The Soviets began building small aircraft carriers, and (at least partially due to the Convention) insisted on calling them 'Large Antisubmarine Cruisers' or 'Aviation Cruisers'. This allowed them to garner passage for these vessels as Capital ships rather than Aircraft Carriers; twice, in 1976 and 1979, Turkey allowed these ships passage through the straits without commenting on their designation despite protests from the NATO powers. Turkey (and the Soviet Union) pointed out correctly that the United States wasn't a signatory to the Convention and hence had no standing. The largest Soviet carrier, the Varyag, was sold (incomplete and stripped) by the Ukraine to China around the turn of the millenium, but her departure for China (under tow, with no electronics or engines) was still a subject of Montreux negotiation.
During and immediately following the 2008 Russia-Georgia War, Turkey denied passage to two United States hospital ships on the grounds that they were military and over the displacement limit. They also refused access to a larger naval unit tasked with delivering aid. Three smaller ships, including a U.S. Arleigh Burke class, were allowed through, despite the fact that the raw combat power of that ship is equivalent, in modern terms, to a capital ship.
Sources:
http://www.globalsecurity.org/military/world/naval-arms-control-1936.htm
http://www.ntip.navy.mil/montreux_convention.shtml
http://www.turkishpilots.org.tr/ingilizcedernek/DOCUMENTS/montro.html
"US assures Turkey over straits convention," Turkish Daily News, August 21 2008. Website URL: http://www.turkishdailynews.com.tr/article.php?enewsid=113138
Origins of the Cold War (Melvyn Leffler, David S. Painter). Routledge Books: Abingdon, UK, 2005.