A grama (Talmudic Aramaic: גרמא) in Halacha (Jewish law) is something that was indirectly[1] caused by something else but which outcome is not guaranteed.
A classic example given to this is of vases that are filled with water and put around a fire in order to extinguish it. This is allowed on Shabbat[2] because it is indirect and because the fire might not extinguish.
In civil law
There is a rule that grama benizakin patur. If somebody caused financial harm to somebody else via an action that was not guaranteed to harm them, the person cannot be forced by a court to pay, although he might be morally obligated to.
On Shabbat
An action which indirectly causes a Shabbat violation due to grama has a lower level of prohibition than an action which violates Shabbat directly. In situations of great need, a grama violation can be permitted.[3]
Based on this, a variety of electrical devices have been developed which violate Shabbat only through grama, and thus can be used in situations of great need, for example in health care or security.[3]