I am not sure what you mean by "applies to numerous generations". If the following does not help, can you please clarify what you meant?
Hamilton's rule expresses the condition for which, under a prisoner's dilemna game (see game theory), the stable equilibrium that will be reached is the one where everyone is cooperating. Hamilton's rule is, therefore, a condition to determine the directionality of a dynamic system (the system is dynamic because the state of the system varies over generations).
what if the values of B and C differ depending on [the generation]
In other words, you are asking
What if the (social or not) environment is changing over time?
Well, under such circumstance, of course, the simplistic rule that consider B and C as constant won't hold.
You could not simply replace B and C by the the arithmetic mean (or by the geometric or harmonic or any other mean) as the system as two stable equilibriums and upon reaching one there would be no way to get out of it (at least as long as the game remains a prisoner's dilemna).