Same-sex couples cannot marry in foreign embassies in countries that don't recognize the marriage between same-sex couples. If the country recognises gay marriage, then you can get married in the country.
A marriage that took place abroad is legal in Belgium if:
* you comply with the Belgian legal conditions to get married.
* the marriage is performed according to the forms that are in use in that country.
If you are Belgian, then all the changes in your civil status are regulated by Belgian law. Even if you are staying in another country, Belgian law will be applied. As a foreigner the marriage conditions of the land of origin are valid.