In general, according to an article in DifferenceBetween.net
The main difference between rules and laws is the consequences associated with breaking them. While each is developed to invoke a sense of order, fair play, and safety, the weight of a law is much heavier than the weight of a rule.
However, in scientific context the situation seems to be somewhat different. For example, in scientific publications we can see Shannon's rule, Shannon's law and Shannon's formula and theorem that all refer to the same concept.
So, the question is what's difference between law and rule in a scientific context, if any?