When can you change the jar size that a tested recipe calls for?
You can use smaller jars than a tested recipe calls for, but not larger.
The reason is that larger jars usually requires a longer processing time for proper heat penetration to the food in the centre of the jar, and thus would require a longer tested and verified processing time to ensure quality and food safety.
Michigan State University says,
You may always use a smaller sized jar, but it is not recommended to use a larger jar.”  Treiber, Lisa. Jam and jelly season is here! Blog posting 1 July 2016. Michigan State University Extension. Accessed July 2016.
When you use a smaller jar, process for the same processing time as for the suggested jar size, unless a separate processing time for the smaller jar is given. The National Center for Home Food Preservation says:
Processing times have not been developed for many foods in half-pint, 12-ounce or 24-ounce (one and one-half pint jars.) If the recipe does not specify processing in one of these jars, process half-pint and 12-ounce jars for the same time as pints. Jars that hold 24 ounces (one and one-half pints) will need to be processed using quart jar times.”  Andress, Elizabeth L. and Judy A. Harrison. So Easy to Preserve. University of Georgia Cooperative Extension. Bulletin 989. Sixth Edition. 2014. Page 23.
Choosing a jar mouth size
You have the choice of regular mouth (70 mm / 2 3⁄4 in) and wide-mouth (86 mm / 3 3⁄8 in.) jars,  Ed: In Canada, there’s a legacy third middle size of jar mouth as well, of 78 mm, called “Gem.”
Wide mouth jars are great for things like dill pickles, whole beets, chicken breasts, pear halves, etc, as it is easier to pack the food in nicely.
Regular mouth jars (usually with the shoulders, narrower mouth) are better for things you want to pour out, like soup or chili. They are also fine for relishes, chutneys, etc. The shoulders can help to push foods down under the canning liquids.
Often, there is a up to a 50% cost premium for wide-mouth jars, so that can be a factor that overrides the above two considerations.
Note that width of the mouth of the jar is independent of the volume of the jar: there is no correlation.
You can use whatever mouth size you want for a recipe.
Jar mouth size and processing time
Note that mouth size does not affect the processing time for either water bath processing, steam canning or pressure canning.
Straight sided versus shoulder
Mason jars either have shoulders, or are straight-sided.
Straight-side jars can be easier to pack. They are also easier to clean when emptied: this can particularly matter if you have canned meat. They are often a bit pricier though.
Regular, shouldered jars are easier to pour from, and are often cheaper. The shoulders help to push food down below the liquid level in the jar so it will look better longer in storage. Nina Corbetta, a blogger, notes:
While I prefer the look of wide-mouth jars, canned fruits or tomatoes fare better in the regular jars as the small opening helps keep the fruit submerged. With the wide mouth jars the fruit rises up to the top sometimes leaving you with an inch or two of liquid on the bottom of the jar, which while it does not affect the fruit, it does not look quite right.”  Corbett, Nina. Canned Pears in Vanilla Syrup. 8 October 2009. Accessed March 2015 at https://www.putsup.com/2009/10/canned-pears-in-vanilla-syrup.html
Freezing in mason jars
Straight shoulder jars are freezer safe. Neither Ball or Bernardin support freezing in shouldered-jars. They are prone to shattering in the freezer because the expanding frozen contents press up against the shoulders.
All mason jars that have straight sides and no shoulders may be used for successful freezing. When freezing, food expands upward and does not take the shape of its container. This can cause jars that are not appropriate for freezing to break.” Freezing with BERNARDIN® Mason Jars. Bernardin FAQ. Accessed June 2017 at https://www.bernardin.ca/en/how-to-can/faq.htm
As for freezer jar headspace, Bernardin further advises:
Leave sufficient head space for the food to expand: ½ inch (1 cm) for freezer jams in 125 or 250 ml size jars. ½ to 1 inch (1 to 2.5 cm) for larger jars, depending on the type of food. Foods with higher water content expand more than foods with dense texture.” Freezing with BERNARDIN® Mason Jars.
Jar side formation — whether straight or shouldered — does not affect the processing time for either water bath processing, steam canning or pressure canning.
2 litre (US half-gallon /2 quart jars)
The current advice (as of 2017) is to use this size of jar in shelf-stable home canning only for two highly-acidic juices: apple juice, and grape juice. It’s ideal as well for batches of refrigerator pickled onions and pickled eggs, etc, as well as for dry storage of pulses, grains, etc.
Penn State Extension says,
Historically, the USDA and others had released guidelines for home canning in this size of jar. They have changed their minds, though, and withdrawn all the recommendations and now advise against it except for the two juices.”  Penn State Extension. Canning With Half Gallon Jars. Accessed January 2015.
So, to be clear: for food preserving uses, you can use this size of jar for canning apple juice and grape juice. OR, use them for storing dried goods in. There is no home-canning use beyond those two juices.
1 ½ litre (1 ½ quart) jars
Ball and Bernardin do support home canning three tomato products in 1 ½ litre (quart) jars. It is covered in the Ball / Bernardin Complete Book. See dedicated piece on that.
|↑1||Treiber, Lisa. Jam and jelly season is here! Blog posting 1 July 2016. Michigan State University Extension. Accessed July 2016.|
|↑2||Andress, Elizabeth L. and Judy A. Harrison. So Easy to Preserve. University of Georgia Cooperative Extension. Bulletin 989. Sixth Edition. 2014. Page 23.|
|↑3||Ed: In Canada, there’s a legacy third middle size of jar mouth as well, of 78 mm, called “Gem.”|
|↑4||Corbett, Nina. Canned Pears in Vanilla Syrup. 8 October 2009. Accessed March 2015 at https://www.putsup.com/2009/10/canned-pears-in-vanilla-syrup.html|
|↑5||Freezing with BERNARDIN® Mason Jars. Bernardin FAQ. Accessed June 2017 at https://www.bernardin.ca/en/how-to-can/faq.htm|
|↑6||Freezing with BERNARDIN® Mason Jars.|
|↑7||Penn State Extension. Canning With Half Gallon Jars. Accessed January 2015.|