In /etc/config/qos (for luci-app-qos) I would use the "classify" option to mark ssh as high priority and torrent as lowest
in /etc/config/sqm (for luci-app-sqm) how do I give higher priority to ssh (identified by port number) and lower to torrent downloads (identified by protocol, ideally, or by port range) ?
Sqm tries by design to stay simple, so out of the box it does not offer any prority filtering mechanisms. That said simple.qos and edpuvially layer_cake.qos will evaluate existing dscp markings to sort packets into 3 prority tiers. If you can mark your application packets according to your wishes that will work. But please note that in ingress that will be a bit tricky as sqm's ingress side runs before iptables becomes available, so you would need to use tc.
Now, the qdiscs used by sqm try to give sparse traffic a small boost, which might be enough to make a ssh command line session cut through a background torrent traffic.
Also cake offers a per-internal-ip-address-fairness mode, if you activate that, all you need to do is to run torrents and ssh on different computers/VMs/containers with different IPs.