We are beginning siman 6, which discusses birkas hagomeil.
Chazal teach us that there are four types of people who are obligated to give thanks to Hashem, based on kapitel 107 in Tehillim. The pesukim describe four scenarios: a person traveling through the sea, a person traveling through the desert, a person who is deathly ill, and a person who is in jail. (Jail is considered a life-threatening venture either due to the jailers, the inmates, or the conditions.) At the beginning of siman 219, the Shulchan Aruch writes that the mnemonic to remember these four groups of people is the word chayim, which stands for chavush, yisurim (sickness), yam and midbar.
The question becomes whether the bracha is extended beyond these four specific cases: are these four cases paradigmatic of other dangerous situations, or are they specific? In siman 219:9, the Shulchan Aruch first writes that the bracha is not limited to these four cases, but any case of a life-threatening situation, such as a robbery or a wall collapsing. However, he brings a second opinion, of the Abudraham, that it is limited to these four cases. The Shulchan Aruch concludes that in any situation other than the four cases mentioned in Chazel, one should recite the bracha without Hashem’s name.
However, the Mishnah Berurah writes that the Achronim disagree with the Shulchan Aruch, and hold that any danger which approximates the four cases in Chazal would receive the bracha with Hashem’s name.
The minhag ashkenazim is to follow the Mishnah Berurah, but the minhag sephardim is to follow the Shulchan Aruch.
Summary
Birkas hagomeil is recited when one is saved from a life-threatening situation. The minhag Sephardim is to recite it only in the four cases mentioned in Chazal, and the minhag Ashkenazim is to recite it after any life-threatening situation.