To show all the mergecode values in a custom input form you can hit CTRL +A to select the entire document and then ALT + F9 to show all the merge fields. This can be important because the first way I'm going to highlight below may completely hide the field when it's toggled.

Way 1:
You can manually enter a MergeField with logic by hitting CTRL + F9, this will create a completely empty field point that looks like this:

This is an important distinction to make, because if you simply type brackets without this keyboard shortcut, it will NOT do the field merge. If it is a field merge, when you click on it once, it will gain this dark grey background.

Plain Text (typed the brackets manually without using CTRL + F9):
Field Code (using CTRL + F9):

Inside of these brackets, you can make Encompass field references by placing them between «» symbols. These can be typed using the following Alt-codes, which are typed by holding the Alt key and typing the number (don't hold the numbers), then release the Alt key. 
«    Alt + 174
»    Alt + 175

The Field Reference will always be «M_FieldID». 

So for instance the merge code for a borrower salutation could be:
Dear { «M_4000» } { «M_4002» } { IF «M_4004» <> "" "and «M_4004» «M_4006»" ""},

This would print:
"Dear Joe Wilson and Jane Wilson, " if both are present
"Dear Joe Wilson," if he's the only borrower.

You’ll notice the first two fields are the Primary Borrower’s First Name and Last Name separated as their own merge fields.
Another way to do this could be:
{ “«M_4000» «M_4002»” }
which is doing one merge field that returns a string (the area between the two quotation marks) containing both the first and last name separated by a space.

The format for if statements is : { IF condition resultTrue resultFalse } so it's very similar to an Excel If statement or an Encompass Calculated Field If statement but without the commas between the different parameters. You can do nested IF statements and several other calculations and formatting tricks within these merge fields. A few examples will be added to this document at a later date.