When Do We Recite HaTov VeHaMeitiv?
The special blessing for wine beyond 'Borei Pri HaGafen'

The Sages instituted the blessing of 'HaTov VeHaMeitiv' (Who is good and does good) when people are drinking wine and a different type of wine is brought before them - one should recite "HaTov VeHaMeitiv" on the second wine. However, there are several conditions for reciting this blessing. One should not recite it unless all the following conditions are met:
No interruption in thought: One should only recite the blessing of HaTov VeHaMeitiv when there was no "hesech hada'at" (interruption in thought) before drinking the second wine. This means that when they sat down to drink the first wine, they intended to continue drinking wine. But if they decided not to drink more wine, for example, if they drank wine during a meal and already recited Birkat HaMazon (Grace After Meals), and afterward another wine was served, then they should not recite HaTov VeHaMeitiv on the second wine.
Some of the first wine remains: One should only recite HaTov VeHaMeitiv when some of the first wine remains. But if none of it remains, one should not recite HaTov VeHaMeitiv on the second wine.
The second wine is not inferior to the first: One should only recite HaTov VeHaMeitiv when the second wine is of better quality than the first. At the very least, they should not know with certainty that the second wine is inferior to the first.
The wines must be of different types: One should only recite HaTov VeHaMeitiv when the second wine is made from a different type of wine. For example, "Merlot" wine and "Cabernet Sauvignon" wine, and the like. However, there is a way to recite HaTov VeHaMeitiv on two wines of the same type when one wine is new and the other is aged. In such a case, even if they are of the same type, one can recite HaTov VeHaMeitiv on the second wine. One can also recite it on two wines of the same type when they are made in different wineries or from different vineyards, in a way that their tastes differ from each other.
There must be at least two people: One should only recite HaTov VeHaMeitiv when at least two people are sitting and drinking together. And both should drink from the first wine, and then from the second wine.
They must drink during a meal: One should only recite HaTov VeHaMeitiv during a meal with bread. But outside of a meal, one should not recite this blessing.
All these details of laws are explained at length in Responsa Yabia Omer, Ninth Part (Section 108). And in the book Chazon Ovadia on the Laws of Blessings. And in the book Halacha Berurah, Ninth Part (Section 175).
Rulings of Rabbi Ovadia Yosef courtesy of "Daily Halacha" website