i think it's easier to get to know it separately because of its typical besides interesting structure: these two words are made of [a noun+a verb], in your case,
气->noun
馁->verb
灰->verb
心->noun
气:the energy
馁:weaken
气馁:the energy has been weakened / your vital energy is going down which generally implies you have been beaten once or many times by sth/sb after having tried damn hard so that you are getting 气馁。
灰:discourage, the grey color usually represents a sad one, so discourage people.
心:the heart
灰心:the color of your heart right now is turning grey-> you have been discouraged, that you are not getting confidence to do it over again, you are 灰心 towards sth.
气馁 is giving emphasize on the energy, [physically] while 灰心 is caring more about your feeling, [mentally].