This is an understandably confusing topic because of how the names evolved, and some of those acronyms have become more of a marketing label rather than an actual term. So I'm going to dive a bit deeper into the origins of these names and why the distinction between them exists.
The term "BEC", which stands for Battery Elimination Circuit, has its roots in gas planes. Since their main thrust source was non-electric, they had a separate (usually NiMH) battery to power the receiver and servos, which since those days traditionally take around 4.8 to 6 volts. So when people started putting electric motors on aircraft for thrust, the arrangement stayed the same for a while: A separate big (and high-voltage) battery for powering the main motor, and a small, 5 volts-ish battery for powering the control electronics, which could not take the higher voltage of the main battery.
Thus, a BEC was a voltage regulator that would eliminate that second battery by providing regulated power for the receiver and servos directly from the main battery.
The simplest BEC is a linear regulator (sometimes called LBEC), a device that drops the voltage of its output by dropping the rest of the voltage on a variable resistor that would dissipate the power flowing through it. The problem with that is that since it works by dissipating the extra power, it's very inefficient when the voltage difference is high: If you've got a 12V main battery and a 5V output consuming 1A of current, the linear BEC must consume the other 7V and 1A of current and lose that to heat. If you've got a 16V battery, that's 11V*1A: more than twice the useful power is just lost to heat! And while you might not care about the loss itself (the main motor is probably eating a whole lot more than that anyway), the fact that the thing heats up like crazy might be a problem.
So if your control electronics and servos are sufficiently power-hungry, you need a switching voltage regulator, or SBEC. Switching regulators convert voltages with hardly any power loss, and so can give out lots of amps without heating up too much. An inherent drawback of these regulators is a slightly oscillating output voltage (the technical term for that is ripple):
Different switchers smooth it out to varying degrees (one of the best ways is to stick a separate linear regulator after the switching one), but it's usually still there even after smoothing.
Anyway, basic plane electronics (i.e. receiver and servos) usually don't care whether there is any ripple or not, as long as it's not too big, so it was the best option for some time.
Somewhere along the way came the idea of integrating this regulator into the ESC, since it gets battery power anyway, and in planes plugs into the receiver with a 3-pin servo header, thus being able to provide regulated power through that header. Thus, for an RC plane, having the BEC built into your ESC means eliminating a whole additional regulator board and not having to wire anything to power your receiver and servos: you only need to plug in the ESC, and voila, all your electronics have power.
For multicopters and multi-motor planes this can get weird, as you have multiple ESCs, and each wants to provide its own power. And having multiple switching regulators try to output to the same place can lead to... unexpected results. Possibly (though unlikely) even explosive, so flight controllers usually have their own BECs and usually don't have pins/pads for power on their motor connections, while bigger planes tend to use a standalone BEC.
Now come the marketing terms. a UBEC is a "Universal" or sometimes even "Ultimate" BEC. These are just (hopefully) high-quality standalone voltage regulators that can feature bigger available currents, higher efficiency, better output ripple smoothing (sometimes via a linear regulator), selectable voltages (5V or 12V, sometimes also 6 and 9V, or even the whole range), better reliability, etc.
OPTO is the weirdest of the bunch. Technically, it stands for "optocoupler", which is a way of electrically isolating your ESC from the other electronics entirely. This can be beneficial when dealing with really high voltages and/or currents, as the voltage ripple generated in the power supply by the motors themselves can be quite high, especially during fast RPM acceleration or braking, and can feed back to your control electronics through either power or ESC control wires. As such, this feature is primarily prominent on the huge, honking 80+ amp airplane ESCs with radiators. However, some quadcopter ESCs are also known to have optocoupling. Since the point of Opto is to not have your FC electrically connected to the ESC, it is almost entirely mutually exclusive with having an inbuilt BEC in the ESC. However on the market that's not always the case, and the term is routinely confused with other things even by the manufacturers, so if you see this marking on an ESC it might be something else. Some models of ESC even use the word OPTO to indicate that they do have an onboard BEC!
Additional reading: