That is not code.
It is an URL Argument. It gets added to the URL, this is the idea.
If you have a RFG, and create a View for those RFG, then you can add **Query Filters** to search one or more of the custom fields in the RFG, by one or many values.
This query has to listen to an URL Argument.
Since you need to pass dynamic value to the Query (the value of the fields of the RFG of the current post), you need an URL argument for that to tell the View, get only those RFG where their fields have value equal to the one passed in the URL argument,
Hence, you create such a Query filter in the view by URL argument for the field as I explained above.
The, you need to (when viewing this View in the front end) tell the view what to filter by, by adding to the URL, the URL parameters you have set in the View, example:
page-with-your-view/?your-url-search-argument-for-field[]=the_value_you_search&your-url-search-argument-for-field=some_other_value_you_search
If you now hit enter and load that URL, it returns all posts with fields with those values.
You cannot produce this filter in the FRONT END for the visitor to alter, the Developers are working on this.
The steps below are leading to the result:
A) Create a Post Type and a RFG attached to that Post Type.
B) The RFG has a single line, for example
C) Create many posts with many RFG and each several Single Lines with values (some the same as on other posts).
D) Create a View, and query the RFG post type
E) In the View set a query filter to return only those posts with the Custom Field (the single line in the RFG) equal to the URL parameter you set
F) Complete the Loop of this View with information either about RFG, the field, or parent post data
G) Insert this View to a Page, and then visit the page. Now you will see all the RFG's - not only the ones with the same value.
Note that you would need another View, querying the current posts's RFGs to output it's fields and put them into the URL parameters.
This means, when you create the Links to the Posts passing the URL arguments, you need a view that gets that posts RFG' fields, and puts them in the URL syntax as I explained above.
As I mentioned this is not a simple solution and requires at least one more view to be created, to create the URL parameters for each post. Then you need to update wherever you link to those single posts (that may be the archive) so the links there pass the URL query argument required for the views to query the RFG's fields value.
Where do you link to those posts from?
That is where you would need to start, by changing those links and making them be like:
site.com/page-with-your-view/?your-url-search-argument-for-field[]=the_value_you_search&your-url-search-argument-for-field=some_other_value_you_search
Currently likely you use something like [wpv-post-link] in an archive, so you will need to change that and use Manual HTML links that you can populate with partially dynamic shortcodes and the above URL arguments.
Once that is done, you will be able to insert the View querying RFG?s to the single posts templates, and when those are visited with the right URL parameters, the right related Posts will show.
If the post is called only with the permalink, no URL parameters added, then all the RFG posts would show, not only related ones.
This could be finally solved with a HTML condition, that listens to the URL parameters as well, and if empty, it would hide the entire View (so no posts are shown as related unless the Query Arguments are present)
I suggest we tackle this last.