That is fin rot disease. How annoying.
Fin Rot can be the result of a bacterial infection (Pseudomonas fluorescens, which causes a ragged rotting of the fin), or as a fungal infection (which rots the fin more evenly and is more likely to produce a white "edge"). Sometimes, both types of infection are seen together.
To heal the fish, add 1 tsp per gallon of aquarium salt to the water. Remember to pre-mix the salt in the water before adding it to the aquarium. It's a good idea to place the betta in the body of water after it's medicated with salt. Do a 90% water change everyday.
Hope this helped!
Good luck with your rainbow fish!!!