This feature is a courtesy of the new iOS 11 operating system, whereby it enables third party applications to filter incoming messages and sort them into a separate SMS Junk tab that appears in the Messages app when you use an app that lets you filter messages just like the new version of Truecaller.
These type of apps can use keyword detection or machine learning algorithms to figure out if the messages you are receiving contained spam or useful and then sort them accordingly
Truecaller is now tapping into this new functionality in iOS 11 to enable this feature. If you use Truecaller on your iOS device, kindly go to your app store and update the app.
Once you update the app, it will guide you on how to enable it.
Just go to Settings > Messages > Unknown & Spam > turn on Truecaller. I'm not quite sure if Truecaller uses simply keyword filtering or machine learning to determine if an incoming message contains spam or not.
You just have to use the app and then determine how effective it is at blocking spam messages and allowing actually useful messages through.

