Heinz and Kraft Foods Group have struck a merger agreement that will create the world's fifth-largest food maker.