If your question is, "How do I know when to put quotes on a parameter?" then the answer is this: if you look in the online help (look in the index) for "SetTargetParameter" you'll see that the type of the first parameter is "string". That means you have to provide a quoted value (or a variable that refers to a string, but I don't think there are any of those).
To explain why is a little harder. Perhaps a series of facts which you can assemble into a sensible answer to your question:
1) All the rules are converted into C# source code when your project is compiled
2) C# is a "strongly typed" language, which means that you can't
directly refer to arbitrary objects and properties that are not known at compile time. For example, I can't refer to the MyObject.x (the x property of MyObject) unless I first force the compiler to see MyObject as a Sprite (and the compiler knows that all objects of type Sprite have property x).
3) Each sprite definition corresponds to a specific "type" of sprite, and the parameters correspond to properties of that type of sprite (that only exist for that sub-type).
4) The environment does not know the specific type of an arbitrary sprite you have found with a function like TestCollisionMask, only that it's some form of sprite. So it can't directly access any properties except those that are defined for all sprites.
5) I can, however, indirectly refer to such properties if I take the more round-about method of providing the property name as a string (I won't bore you with the details of that).
6) Literal string values must be contained in quotes in C# (and most other languages for that matter).
7) Because parameters provided in the rule editor can represent strings or other values, you must distinguish which parameters are strings by enclosing them in quotes yourself (the IDE can't infer when you want a parameter to be a string).
So to sum it up, the final code will do something like this, in plain English:
"Hey .NET, I have a sprite object, can you give me a tool I can use to access a property named 'Hit' on it for sprites that have a property by that name? Cool, thanks. Now use that tool to change the value of that parameter on this sprite I just found to 1."
That's not entirely accurate, but maybe close enough without having to write a semester's worth of object oriented programming theory

.