Putting <if> inside a <message> isn't possible currently. If you have a long message where only the first line/sentence is different, then one workaround is to split the message into two parts, provide two variants of the first part using <if><else>, then do runtime concatenation to create the full message.
You could modify grit to support this use case, though I'm not sure how tricky that would be and I certainly wouldn't recommend it as a first resort. Note that one downside of supporting <if> inside a <message> is that it can easily hide the amount of text being sent to translators (real people). E.g. <message>Lots of text... <if expr="use_titlecase>Some Title</if> lots more text ... <if expr="is_mac">Mac-specific text</if> more text ...</message>. That would generate 4 long strings, each of which would have to be translated separately. A lot more translation work than is probably necessary.