When it scans an ip address, it engages with different forms of communication protocols expected of the port, ie it talks email protocols on the email ports and web browser protocols on the web server ports.
Now its possible to change the agent name of software running behind a port, and Shodan almost certainly have some rules which throws up results as per their criteria.
Maybe you should ask their support dept for a comment to your specific question? support@shodan.io