You can use the TDL statement:
<[If StringValueEquals StringValueName__QuotedString]>
text
<[EndIf]>
where StringValueName is CustomPropertyName or CustomPropertyValue and QuotedString is the value in quotes to compare with. Use this if statement in a foreach statement like this one:
<[Foreach CustomProperty Argument Separator]>
text
<[NextForeach]>
See the SDK docs of TDL for details about these statements.