Antenna gain generally refers to the maximum gain of the antenna unless the context makes it clear that some specific elevation or azimuth angle is being considered.
For a directional antenna such as a yagi, the forward gain is therefore the maximum gain of the antenna unless otherwise qualified. The gain in the azimuth direction 180 degrees opposite of the maximum forward gain (and generally at the same elevation) is the rearward (back) gain of the antenna.
If the forward and rearward gain is expressed in dB (e.g. dBi or dBd), then the front to back ratio is the forward gain minus the rearward gain. The result is then expressed in dB. For example, if the forward gain is 10 dBi and the rearward gain is -3 dBi, then the front to back ratio is 13 dB.
From a practical perspective, you can measure the front to back ratio if you have a remote signal that you can monitor while propagation is constant. Turn the antenna to find the maximum signal strength of the remote signal and note the signal strength in dB form. Turn the antenna 180 degrees from that direction and again note the signal strength in dB form. Subtract the forward dB value from the reverse dB value to compute the front to back ratio.
If you only have an s-meter available to make comparative measurements, each s-unit is generally 6 dB so you can approximate the front to back ratio by making the appropriate measurements and conversions and then subtracting the two values as described above.