The complexity of the script depends highly on how your rasters are named. Let's assume a simple well structured case. Rasters in both folder share part of the name but have different prefixes: "MYD09GQ" and "MYDTBGA". In that case you would list the rasters of one of the folders and deduce name of the corresponding rasters in the other folder, perform the difference calculation (Minus) and store the result.
An example of what this (untested) code could look like:
def main():
import arcpy
import os
folder1 = r'C:\Path\To\Folders\With\Rasters1'
folder2 = r'C:\Path\To\Folders\With\Rasters2'
out_folder = r'C:\Path\To\Folders\With\Result'
prefix1 = 'MYD09GQ'
prefix2 = 'MYDTBGA'
prefix_result = 'DIF'
arcpy.env.workspace = folder1
lst1 = arcpy.ListRasters()
arcpy.CheckOutExtension("SPATIAL")
for ras_name1 in lst1:
ras1 = os.path.join(folder1, ras_name1)
ras_name2 = ras_name1.replace(prefix1, prefix2)
ras2 = os.path.join(folder2, ras_name2)
dif = arcpy.sa.Minus(ras1, ras2)
out_name = ras_name1.replace(prefix1, prefix_result)
out_path_name = os.path.join(out_folder, out_name)
dif.saveas(out_path_name)
arcpy.CheckInExtension("SPATIAL")
if __name__ == '__main__':
main()