BMW and Toyota, two giants of the automotive world, have announced a "medium-to long-term partnership" that will see them develop and share green technologies.