If you reverse the order you will see that "for" couldn't be correct in this example: It is difficult to capture [the Grand Canyon] in a single photograph because of the vastness of [it]. (correct) It is difficult to capture [the Grand Canyon] in a single photograph for the vastness of [it]. (incorrect) The second sentence you give is an exception in which both would be correct: For his ideas and actions, he went to jail.
New words, one handy idiom, and a 2-minute quiz — delivered to your inbox to keep your streak alive.
when you are talking about the reason why a statement is true or why something happened, use "because of"