Bosnia and Herzegovina is divided intro three parts: two entities, Republika Srpska (not sure how to translate this into English) and Federation of Bosnia and Herzegovina and a neutral part called District Brcko. Kantons are smaller regions within these two entities which operate as a smaller version of the government.
Yugoslavia was not divided into new countries after the war. When it was founded, it consisted of already mentioned republics.