I don't know what tutorial you are following, but getting the peaks to become white isn't hard. If you use the displacement of a fractal (preferably with stretched Y) you can add a (blue node) displacement to scaler node, and add a color adjust after that to balance the amount and softness of white on the peaks. If you are using the colors of a fractal to feed into a displacement shader for the waves, you can feed the same colors through a color adjust for the foam on the tops in an added surface layer. But there are more ways, like using the displacement intersection, favor rises, or even the altitude range settings in a surface shader.