Theories given by differential equations give some clearcut examples.
The solutions are determined by boundary conditions. If the theory includes both the differential equations and the boundary conditions, the most obvious counterfactual is to keep the differential equations and change the boundary conditions to a different set of admissible boundary conditions.
A simple example is provided by the equations of celestial mechanics regarding the planets as point masses. We can use the equations to predict the future of the system from the present but with Mars having a different position and velocity than it has at present. We can also solve the equations supposing a sudden change in the mass of Mars in this theory.
A more complex theory in which Mars has a distribution of mass, which might be necessary to predict the future positions of Deimos and Phobos (the moons of Mars), would not consider a sudden change of the mass of Mars that didn't specify how the new mass was distributed as a definite alternate initial state.
Other counterfactuals are not meaningful in celestial mechanics, e.g. what if Mars had a circular orbit. This isn't meaningful, because even if Mars started along a circle, you would have to make arbitrary assumptions in order to keep it there and might end up violating the law of conservation of momentum.
However, the differential equations don't need to involve time to admit counterfactuals. A theory that gives the distribution of potential in a region as a function of the distribution on the boundary can also consider altered values on the boundary.
The same considerations that apply to differential equations apply to difference equations.
What if the deuteron had a mass one percent larger than it does? For chemistry and the theory of atomic spectra this is a reasonable counterfactual. For example, its effect on spectra and the rate of chemical reactions could be predicted. However, this is a meaningless counterfactual for nuclear physics, because it doesn't say whether the extra mass is in the proton or the neutron or somewhere else. Quantum mechanics doesn't tolerate giving a proton or neutron a different mass in a particular atom, because it violates the notion of identical particles required to apply the anti-symmetry rule for wave functions.
Thus we see that counterfactuals reasonable at one level of theory may be unreasonable at a more fundamental level.
Such counterfactuals in physics are appropriately handled informally -- as long as the physicists are people. Robotic common sense reasoning requires a formal treatment.