Frothy urine is generally indicative of fat and protein ending up in the urine as part of a nephritic syndrome. Hydration levels have little to do with it, and most normal diets won’t change the consistency of urine.
If you are suffering from frothy urine consult a doctor as there are several possible underlying conditions causing a nephritic syndrome, some of them serious. They all affect the kidneys, which should not usually allow substantial amounts of protein into the urine. When the kidneys get damaged they can allow protein into the urine. Protein normally doesn’t leave the bloodstream as the filtration “holes” in the kidneys aren’t large enough to allow proteins through, so only in states of damage do the kidneys allow protein to filter out.
The increased urine fat content in nephritic syndrome is the result of the body losing protein and trying to compensate for the loss of colloid osmotic pressure (having soluble proteins) in the blood by increasing the fat content of the blood. This spills over into the urine.
There may be dietary additives or other chemicals which are disproportionately filtered out by the kidney causing high protein content in the urine. Either way, it is wise to consult a doctor, taking a urine sample with you so they can dip your urine and check for protein and anything else unexpected such as infection markers.