Custom Metadata is any metadata defined in your schema that gets set at the Component or Page level.
If the component's schema has metadata fields, and you put data in there, and you publish it - you get Custom Metadata on the delivery database.
Your question seems to suggest that you want to put Component B's data into Component A's Metadata. Out of the box, this is not possible. There are some creative people out there that wrote deployer extensions and such to add metadata to a component when it is published, but these are usually custom extensions that may or may not be supported - and may or may not be compatible with what you're trying to do.